package com.example.testdemo.bean;

import com.example.testdemo.model.UserInfo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

@Component
public class BeanConfig {
    @Bean
    public String name() {
        return "zhangsan";
    }
    @Bean
    public String name1() {
        return "lisi";
    }
//    @Primary
    @Bean
    public UserInfo userInfo1(String name) {
        UserInfo userInfo = new UserInfo();
        userInfo.setId(2);
        userInfo.setName(name);
        userInfo.setAge(23);
        return userInfo;
    }
    @Bean
    public UserInfo userInfo2() {
        UserInfo userInfo = new UserInfo();
        userInfo.setId(1);
        userInfo.setName("lisi");
        userInfo.setAge(13);
        return userInfo;
    }
}

